package org.java.user.repositiry;


import org.java.user.api.damain.Role;
import org.java.user.api.damain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;
@Repository
//JpaSpecificationExecutor自定义查询方法
public interface UserRepository extends JpaRepository<User, String> , JpaSpecificationExecutor<User> {


     Optional<User> findByLoginName(String loginName);

    Optional<User> findByMobilePhone(String name);

    Optional<User> findByEmail(String name);

    List<User> findByRolesIn(List<Role> roles);
}
